package com.yitao.cms.constant;

import java.util.HashMap;
import java.util.Map;

public class SmsMessagesConstant {

    public static final Integer SMS_LIMITATION = 10;

    /**
     * 全局请求结果
     *
     * @author GuoMingJun
     */
    public enum ResponseDtoEnum {

        /* 成功 */
        SUCCESS(0),
        /* 失败 */
        FAILURE(1);

        private static final Map<Integer, ResponseDtoEnum> map = new HashMap<>();

        static {
            ResponseDtoEnum[] values = ResponseDtoEnum.values();
            for (ResponseDtoEnum responseDtoEnum : values) {
                map.put(responseDtoEnum.value, responseDtoEnum);
            }
        }

        private final Integer value;

        private ResponseDtoEnum(Integer value) {
            this.value = value;
        }

        public static ResponseDtoEnum getEnum(Integer value) {
            return map.get(value);
        }

        public Integer getValue() {
            return value;
        }
    }


    public enum YesOrNoEnum {

        NO(0, "否"),
        YES(1, "是");

        private static final Map<Integer, YesOrNoEnum> map = new HashMap<>();

        static {
            YesOrNoEnum[] values = YesOrNoEnum.values();
            for (YesOrNoEnum yesOrNoEnum : values) {
                map.put(yesOrNoEnum.code, yesOrNoEnum);
            }
        }

        private final Integer code;
        private final String name;

        private YesOrNoEnum(Integer code, String name) {
            this.code = code;
            this.name = name;
        }

        public static YesOrNoEnum getEnum(Integer code) {
            return map.get(code);
        }

        public Integer getCode() {
            return code;
        }

        public String getName() {
            return name;
        }
    }
}
